﻿using System;
using FrameWork.Core.China;
using System.Collections.Generic;
using FrameWork.Core.Chain.Entitys;

namespace FrameWork.Core.Chain.Invengo
{
    public class InvengoProcess<R> : ProcessBase where R : ProcessDataBase
    {
        public R Record { get; set; }
        /// <summary>
        /// 流程开始 - 前方法
        /// </summary>
        public virtual Func<R, bool> Prepare { get; }
        /// <summary>
        /// 流程执行完 - 后方法
        /// </summary>
        public virtual Action<R> ClearUp { get; }

        public IEnumerable<IProcessNode> Nodes { get; set; }

        private Func<ProcessBase, IEnumerable<IProcessNode>> DefaultFilter = null;

        public override Func<ProcessBase, IEnumerable<IProcessNode>> ProcessNodeFilter
        {
            get { return DefaultFilter; }
            set { DefaultFilter = value; }
        }
    }
}